package com.example.ycdyus.dailyfruit.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by ycdyus on 2015/10/9.
 */
public class GuoshiViewPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> list;

    public GuoshiViewPagerAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return list!=null&&!list.isEmpty()?list.get(position):null;
    }

    @Override
    public int getCount() {
        return list!=null&&!list.isEmpty()?list.size():0;
    }
}
